package com.example.OJ.controller;

import com.example.OJ.compile.Answer;
import com.example.OJ.compile.Question;
import com.example.OJ.dao.Problem;
import com.example.OJ.dao.ProblemDAO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/problem")
public class ProblemController {
    ProblemDAO problemDAO = new ProblemDAO();

    @RequestMapping("/getAll")
    public List<Problem> getAll(){
        List<Problem> problems = problemDAO.selectAll();
        return problems;
    }

    @RequestMapping("/getOne")
    public Problem getOne(int id){
        Problem problem = problemDAO.selectOne(id);
        return problem;
    }
}
